public class HomeWork {
    public int missingNumber(int[] nums) {
        int n = nums.length;
        int sum = n * (n + 1) / 2;
        int sum2 = 0;
        for (int num : nums) {
            sum2 += num;
        }

        return sum - sum2;
    }
    public void rotate(int[] nums, int k) {
        int n=nums.length;
        k=k%n;
        if(k==0) return;

        int[] temp=new int[n];
        for (int i = 0; i < n; i++) {
            temp[(i+k)%n]=nums[i];
        }
        for (int i = 0; i < n; i++) {
            nums[i]=temp[i];
        }
    }
}
